import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
const { resolve } = require('path');
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: [
      {
        find: '@',
        replacement: resolve(__dirname, 'src')
      },
      {
        find: '@a',
        replacement: resolve(__dirname, 'src/assets')
      },
      {
        find: '@api',
        replacement: resolve(__dirname, 'src/api')
      },
      {
        find: '@pages',
        replacement: resolve(__dirname, 'src/pages')
      }
    ]
  },
  server: {
    open: true,
    port: 8080,
    host: '127.0.0.1',
    proxy: {
      '/api/': {
        target: 'http://101.132.111.87/',
        // target: 'http://127.0.0.1:8000/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  }
});
